package view;

import pojo.Employee;

import java.util.Iterator;
import java.util.List;

public class EmployeeView {
    public static void printAllEmployee(List list){
        Iterator iterator = list.iterator();
        System.out.println("员工ID\t员工姓名\t性别\t年龄\t月薪\t所属部门\t部门ID\t入职时间");
        while(iterator.hasNext()){
            Employee employee = (Employee) iterator.next();
            System.out.println(
                    employee.getEmployeeId()+"\t"
                    + employee.getName()+"\t"
                    + employee.getSex()+"\t"
                    + employee.getAge()+"\t"
                    + employee.getSalary()+"\t"
                    + employee.getDepartment().getName()+"\t"
                    + employee.getDepartment().getId()+"\t"
                    + employee.getEntryDate()
                    );
        }
        System.out.println();
    }

    public static void printEmployee(Employee employee){
        System.out.println("姓名: "+employee.getName());
        System.out.println("性别: "+employee.getSex());
        System.out.println("年龄: "+employee.getAge());
        System.out.println("月薪: "+employee.getSalary());
        System.out.println("部门(ID): "+employee.getDepartment().getName()+"("+employee.getDepartment().getId()+")");
        System.out.println("入职日期: "+employee.getEntryDate());
    }

}
